package ym.mappers;

import org.apache.ibatis.annotations.*;
import ym.obj.User;

import java.util.List;
import java.util.Map;

public interface UserMappers {

    // 根据id查询
    @Select("SELECT * FROM User WHERE id = #{id}")
    User getUserById(int id);

    @Select("SELECT * FROM User WHERE id = #{id} and name = #{name}")
    User getUserByIdAndName(@Param("id") int id, @Param("name") String name);

    @Insert("insert into user (id,name,pwd) values (#{id},#{name},#{pwd})")
    void addUser(User user);

    @Update("update user set name=#{name},pwd=#{pwd} where id = #{id}")
    void updataUser(User user);

    @Delete("delete from user where id = #{id}")
    void deleteUser(int id);

}
